package com.coder520.util;

import java.util.Calendar;
import java.util.Date;

/**
 * Created by ASUS on 2017/7/6.
 */
public class DateUtil {

    private static Calendar calendar = Calendar.getInstance();

    public static int getTodayWeek(){


        calendar.setTime(new Date());

        int week  = calendar.get(Calendar.DAY_OF_WEEK)-1;

        return week<0?7:week;
    }

    public static int getMunite(Date startDate,Date endDate){
        Long startDateTime = startDate.getTime();
        Long  endDateTime= endDate.getTime();

        int munite = (int) ((endDateTime-startDateTime)/1000/60);
        return munite;
    }

    /**
     * 获取某时间
     */
    public static Date getDate(int hour,int munite){
        calendar.set(Calendar.HOUR_OF_DAY,hour);
        calendar.set(Calendar.MINUTE,munite);
        return  calendar.getTime();
    }

}
